package edu.pku.hawk.service.launcher;

import java.rmi.Naming;
import java.util.HashMap;

import junit.framework.TestCase;
import edu.pku.hawk.controller.util.SensorAllData;
import edu.pku.hawk.service.SensorDataSer;
import edu.pku.hawk.service.bo.RowSensorData;

public class TestClient extends TestCase {

	    private SensorDataSer service;
	 
	    
	    @Override
	    protected void setUp() throws Exception {
	         //scaDomain = SCADomain.newInstance("CalculatorRMIServer.composite");
	    	service = (SensorDataSer)Naming.lookup("//172.16.0.54:9000/SensorDataService");
	    }
	    
	    @Override
	    protected void tearDown() throws Exception {
//	        scaDomain.close();
	    }

	    public void testQueryAllSensors() throws Exception {
	    	 // Calculate
	         HashMap<Integer,SensorAllData> data=service.queryAll();
	         System.out.println(data);
	    }
	    
	    public void testQuerySensorCompact(){
	    	 RowSensorData data=service.getBySensorCompact("sensor_rfid", 0);
	    	 System.out.println(data.sensorId);
	    	 System.out.println(data.value);
	    	 System.out.println(data.gettime());
	    }
	    
	}


